
********************************************************************
***** EMPIRICAL ANALYSIS OF THE SUPPLEMENTARY APPENDIX:  GENDER AND COLLABORATION (LORENZO DUCTOR, SANJEEV GOYAL AND ANJA PRUMMER)
***** Start: 15/12/2020
***** Last change:  12/09/2021
***** CREATED BY: Lorenzo Ductor (lductor@ugr.es)   
***** OBJECTIVE: Replicate Tables and Figures of Sections B-D
********************************************************************


/**********************SECTION B. ROBUSTNESS: RESEARCH OUTPUT**********************/
  
use auth7017fields5y,clear
xtset auth year, yearly

foreach i in scites{
replace `i'=0 if missing(`i')
gen `i'5y=(`i'+L.`i'+L2.`i'+L3.`i'+L4.`i')
}
foreach i in saisd{
gen `i'10y=(`i'+L.`i'+L2.`i'+L3.`i'+L4.`i'+L5.`i'+L6.`i'+L7.`i'+L8.`i'+L9.`i')
}
replace scites5y=. if snpapers5y==0 

gen citespp=scites5/snpapers5y
gen lcitespp=log(citespp+1)
gen avgprod=sprodd5/snpapers5y

/*TABLE B.3*/

* KY index.Results presented in Table B.3*

reg sprodd5y i.femaleapi i.t i.year sa-sz, cluster(auth) 
margins femaleapi, atmeans  
ttest sprodd5y if e(sample), by(femaleapi) unequal

* Citations per paper. Results presented in Table B.3*
reg citespp i.femaleapi i.t i.year sa-sz if year<2012, cluster(auth)  /*Citations not available after 2011*/
margins femaleapi, atmeans 
ttest citespp if e(sample), by(femaleapi) unequal


*Non-discounted output. Results presented in Table B.3*
gen lsais5y=log(sais5y+1)
set more off
reg sais5y i.femaleapi i.t i.year sa-sz, cluster(auth) 
margins femaleapi, atmeans  
ttest sais5y if e(sample), by(femaleapi) unequal


* 3 year and 10 year. Results presented in Table B.3*
set more off
reg saisd3y i.femaleapi i.t i.year sa-sz, cluster(auth) 
margins femaleapi, atmeans  
ttest saisd3y if e(sample), by(femaleapi) unequal

reg saisd10y i.femaleapi i.t i.year sa-sz, cluster(auth) 
margins femaleapi, atmeans  
ttest saisd10y if e(sample), by(femaleapi) unequal

*Alternative models*


*2) TABLE B.4. Research output: Correlated Random Effect

foreach i of varlist sa-sz{
bys auth: egen m`i'=mean(`i')
}
xtreg saisd5y femaleapi i.t i.year sa-sz msa-msz, cluster(auth) re
gen sample1=1 if e(sample)

set more off
xtreg saisd5y femaleapi if sample1==1, cluster(auth) re
outreg2 using Tableprodpols, tex dec(3) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) replace
xtreg saisd5y femaleapi i.t i.year sa-sz msa-msz, cluster(auth) re
outreg2 using Tableprodpols, tex dec(3) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 
xtreg snpapers5y femaleapi i.t i.year sa-sz  msa-msz, cluster(auth) re
outreg2 using Tableprodpols, tex dec(3) eqkeep(snpapers) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, NO) 
xtreg snpapersAA5y femaleapi i.t i.year sa-sz  msa-msz, cluster(auth) re
outreg2 using Tableprodpols, tex dec(3) eqkeep(snpapers) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, NO) 


*3) TABLE B.5. Research output: Negative Binomial
set more off
nbreg snpapers5y femaleapi i.t i.year  sa-sz, cluster(auth) irr
outreg2 using Tableprodnb, tex dec(3) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 

nbreg snpapersAA5y femaleapi i.t i.year  sa-sz, cluster(auth) irr
outreg2 using Tableprodnb, tex dec(3) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 

nbreg citespp femaleapi i.t i.year  sa-sz, cluster(auth) irr
outreg2 using Tableprodnb, tex dec(3) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 


*4) TABLE B.6. Research Output: Quantile regressions
gen tsq=t^2
set more off
qreg saisd5y femaleapi t tsq year, vce(rob) quantile(.75)
outreg2 using Tableqreg, tex dec(3) label addtext(JEL codes FE, YES) replace
qreg saisd5y femaleapi t tsq   year, vce(rob) quantile(.90)
outreg2 using Tableqreg, tex dec(3) label addtext(JEL codes FE, YES) 
qreg saisd5y femaleapi t tsq   year, vce(rob) quantile(.95)
outreg2 using Tableqreg, tex dec(3) label addtext(JEL codes FE, YES) 
qreg saisd5y femaleapi t tsq   year, vce(rob) quantile(.99)
outreg2 using Tableqreg, tex dec(3) label addtext(JEL codes FE, YES) 

* 5) Research Output: Research Stream Sample. Results presented in Table B.3*/
bys auth: egen minpapers=min(snpapers5y)
drop if minpapers<3

set more off
reg saisd5y i.femaleapi i.t i.year sa-sz, cluster(auth)  /*AIS quality measure*/
panels auth if e(sample) 
margins femaleapi, atmeans
ttest saisd5y if e(sample), by(femaleapi) unequal

reg snpapersAA5y i.femaleapi i.t i.year sa-sz, cluster(auth) 
margins femaleapi, atmeans  
ttest snpapersAA5y if e(sample), by(femaleapi) unequal

reg snpapers5y i.femaleapi i.t i.year sa-sz, cluster(auth) 
margins femaleapi, atmeans  
ttest snpapers5y if e(sample), by(femaleapi) unequal



/******************SECTION C Robustness: Gender Differences in Networks**********************/

/*1) CREATING NETWORKS VARIABLES OF 3 AND 10 YEARS, DO ONLY ONCE. NEED TO RUN THE R CODE "networkvar_genderpaper7017.R" FIRST*/

/*Joining network variables of 3 and 10 years.*/
/*Do only once*/

set more off
forvalues i=1972/2017{
use articles7017, clear
gen year2=.
drop if year<`i'-2
keep if year<`i'+1
drop if auth2==. & nauthors>=2
drop if auth3==. & nauthors>=3
drop if auth4==. & nauthors>=4
drop if auth5==. & nauthors>=5
drop if auth6==. & nauthors>=6
drop if auth7==. & nauthors>=7
keep articleid year auth1 auth2 auth3 auth4 auth5 auth6 auth7 nauthors year2 
bys articleid: gen t=_n
reshape long auth, i(articleid t) j(n)
drop if auth==.
bys articleid auth: gen np=_n /*checking articles with duplicated auth id*/
bys articleid auth: gen sn=_N
keep if np==1 /* 10 articles with duplicated authid, keeping one*/
gen x=1
drop n sn
bys auth: egen snpapers5=sum(x)
drop if nauthors<2
expand nauthors
sort articleid auth
by articleid auth: gen numid2 = _n
by articleid: gen auth2 = auth[nauthors * numid2]
drop if auth==auth2
bys auth: gen d=_n
bys auth: egen degree=max(d)
egen newid = group(auth auth2)
bys newid: gen intensity = _N
bys newid: gen intensityd =intensity/(nauthors-1)
drop if newid==.

keep auth auth2 newid intensity intensityd snpapers5 year2 degree
duplicates drop
bys auth: egen strength=mean(intensity)
bys auth: egen strengths=sum(intensity)
bys auth: egen strengthd=mean(intensityd)
bys auth: egen strengthsd=sum(intensityd)
bys auth: gen strengthppaper=strength/snpapers5
bys auth: gen strengthppaperd=strengthd/snpapers5
keep auth strengthppaper year2
rename strengthppaper strengthppaper3y
duplicates drop
replace year2=`i'
save strength`i'_3y,  replace 
}

use strength1972_3y, clear
forvalues i=1973/2017{
append using strength`i'_3y
}
rename year2 year
rename auth auth
save strength7017_3y, replace



*Strength 10y
forvalues i=1979/2017{
use articles7017, clear
gen year2=.
drop if year<`i'-8
keep if year<`i'+1
drop if auth2==. & nauthors>=2
drop if auth3==. & nauthors>=3
drop if auth4==. & nauthors>=4
drop if auth5==. & nauthors>=5
drop if auth6==. & nauthors>=6
drop if auth7==. & nauthors>=7
keep articleid year auth1 auth2 auth3 auth4 auth5 auth6 auth7 nauthors year2 
bys articleid: gen t=_n
reshape long auth, i(articleid t) j(n)
drop if auth==.
bys articleid auth: gen np=_n /*checking articles with duplicated auth id*/
bys articleid auth: gen sn=_N
keep if np==1 /* 10 articles with duplicated authid, keeping one*/
gen x=1
drop n sn
bys auth: egen snpapers5=sum(x)
drop if nauthors<2
expand nauthors
sort articleid auth
by articleid auth: gen numid2 = _n
by articleid: gen auth2 = auth[nauthors * numid2]
drop if auth==auth2
bys auth: gen d=_n
bys auth: egen degree=max(d)
egen newid = group(auth auth2)
bys newid: gen intensity = _N
bys newid: gen intensityd =intensity/(nauthors-1)
drop if newid==.

keep auth auth2 newid intensity intensityd snpapers5 year2 degree
duplicates drop
bys auth: egen strength=mean(intensity)
bys auth: egen strengths=sum(intensity)
bys auth: egen strengthd=mean(intensityd)
bys auth: egen strengthsd=sum(intensityd)
bys auth: gen strengthppaper=strength/snpapers5
bys auth: gen strengthppaperd=strengthd/snpapers5
keep auth strengthppaper year2
rename strengthppaper strengthppaper10y
duplicates drop
replace year2=`i'
save strength`i'_10y,  replace 
}

use strength1979_10y, clear
forvalues i=1980/2017{
append using strength`i'_10y
}
rename year2 year
rename auth auth
save strength7017_10y, replace

/*Do only once: Creating data 3: Networks 3-year (need to run the R code first)*/
set more off
forval i = 1972/2011{
insheet using "network`i'_3y.csv",clear
gen year=`i'
drop v1
rename vgauth auth
sort auth year
order auth year
rename vgdeg degree3y
rename vgdeg2 degree23y
rename vgtran clustering3y
save network`i'_3y,replace
}
use network1972_3y, clear
forval i = 1973/2011{
append using network`i'_3y
}
drop if degree3y==0
save network_3y, replace



set more off
forval i = 1979/2011{
insheet using "network`i'_10y.csv",clear
gen year=`i'
drop v1
rename vgauth auth
sort auth year
order auth year
rename vgdeg degree10y
rename vgdeg2 degree210y
rename vgtran clustering10y
save network`i'_10y,replace
}
use network1979_10y, clear
forval i = 1980/2011{
append using network`i'_10y
}
drop if degree10y==0
save network_10y, replace




/*2) Empirical analysis*/	   
use auth7017fields5y,clear
xtset auth year, yearly
foreach i in scites{
replace `i'=0 if missing(`i')
gen `i'5y=(`i'+L.`i'+L2.`i'+L3.`i'+L4.`i')
}


foreach i in snpapers{
replace `i'=0 if missing(`i')
gen `i'6y=(`i'+L.`i'+L2.`i'+L3.`i'+L4.`i'+L5.`i')
gen `i'7y=(`i'+L.`i'+L2.`i'+L3.`i'+L4.`i'+L5.`i'+L6.`i')
}


drop if ystart<1974


replace scites5y=. if snpapers5y==0 


gen citespp=scites5/snpapers5y
gen lcitespp=log(citespp+1)
gen avgprod=sprodd5/snpapers5y


foreach i in ncopapers{
replace `i'=0 if missing(`i')
gen `i'3y=(`i'+L.`i'+L2.`i')
}
gen coauthorship3y=ncopapers3y/snpapers3y

foreach i in snpapers ncopapers{
gen `i'l=L.`i'
gen `i'l2=L2.`i'
gen `i'l3=L3.`i'
gen `i'l4=L4.`i'
gen `i'l5=L5.`i'
gen `i'l6=L6.`i'
gen `i'l7=L7.`i'
gen `i'l8=L8.`i'
gen `i'l9=L9.`i'
}
egen sncopapers10y=rowtotal(ncopapers ncopapersl ncopapersl2 ncopapersl3 ncopapersl4 ncopapersl5 ncopapersl6 ncopapersl7 ncopapersl8 ncopapersl9)
egen snpapers10y=rowtotal(snpapers snpapersl snpapersl2 snpapersl3 snpapersl4 snpapersl5 snpapersl6 snpapersl7 snpapersl8 snpapersl9)
gen coauthorship10y=sncopapers10y/snpapers10y


/*Table C.9: Networks and Gender: Correlated Random Effect and Negative Binomial*/
set more off

foreach i of varlist sa-sz{
bys auth: egen m`i'=mean(`i')
}

set more off
xtreg coauthorship5y femaleapi dcoauthorship5y i.year i.t sa-sz msa-msz, vce(cluster auth)
outreg2 using Tablenetz_cre, tex dec(3) keep(femaleapi cproddl5) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) replace
nbreg degree femaleapi ddegree i.year i.t sa-sz, vce(cluster auth)  
outreg2 using Tablenetz_cre, tex dec(3) keep(femaleapi cproddl5) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 
xtreg degree femaleapi ddegree i.year i.t sa-sz msa-msz, vce(cluster auth)  
outreg2 using Tablenetz_cre, tex dec(3) keep(femaleapi cproddl5) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 
xtreg strengthppaper femaleapi dstrengthppaper i.year i.t sa-sz msa-msz, vce(cluster auth)
outreg2 using Tablenetz_cre, tex dec(3) keep(femaleapi cproddl5) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 
xtreg clustering femaleapi dclustering i.year i.t sa-sz msa-msz, vce(cluster auth)
outreg2 using Tablenetz_cre, tex dec(3) keep(femaleapi cproddl5 degree) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 

	
	
/*Table C.10: Networks and Gender: Random Effect*/
set more off
xtreg coauthorship5y femaleapi dcoauthorship5y i.year i.t sa-sz, vce(cluster auth)
outreg2 using Tablenetzre, tex dec(3) keep(femaleapi cproddl5) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) replace
xtreg degree femaleapi ddegree i.year i.t sa-sz, vce(cluster auth)  
outreg2 using Tablenetzre, tex dec(3) keep(femaleapi cproddl5) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 
xtreg strengthppaper femaleapi dstrengthppaper i.year i.t sa-sz, vce(cluster auth)
outreg2 using Tablenetzre, tex dec(3) keep(femaleapi cproddl5) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 
xtreg clustering femaleapi dclustering i.year i.t sa-sz, vce(cluster auth)
outreg2 using Tablenetzre, tex dec(3) keep(femaleapi cproddl5 degree) eqdrop(lnalpha) label addtext(Career-time FE, YES, Year FE, YES, JEL codes FE, YES) 

	



*6) OTHER NETWORK PERIODS

joinby auth year using network_3y, unmatched(master)
drop _merge
joinby auth year using network_10y, unmatched(master)
drop _merge

joinby auth year using strength7017_3y, unmatched(master)
drop _merge
joinby auth year using strength7017_10y, unmatched(master)
drop _merge


/*Creating log variables
foreach i in netprodaisf netprodaism avgtcof avgtcom avgcot{
	gen l`i'=log(`i'+1)
}
*/
/*replacing missing values in networks by 0 and adding missing dummies*/
foreach i in coauthorship3y degree3y strengthppaper3y clustering3y{ 
    gen d`i'=1 if missing(`i') & snpapers3!=.
	replace d`i'=0 if missing(d`i') & snpapers3y!=.
	replace `i'=0 if missing(`i') & snpapers3y!=.
}
foreach i in degree10y strengthppaper10y clustering10y{ 
    gen d`i'=1 if missing(`i') & snpapers10!=.
	replace d`i'=0 if missing(d`i') & snpapers10y!=.
	replace `i'=0 if missing(`i') & snpapers10y!=.
}


reg snpapersAA5y i.femaleapi i.t i.year sa-sz, cluster(auth)
gen e=1 if e(sample)
set more off


*Table C.8: Gender Differences in Networks. Alternative samples*

reg degree3y i.femaleapi ddegree3y i.year i.t sa-sz if e==1, vce(cluster auth)  
margins i.femaleapi, at(ddegree3y==0)
reg degree3y i.femaleapi ddegree3y if e==1, vce(cluster auth)  
margins i.femaleapi, at(ddegree3y==0)


reg strengthppaper3y dstrengthppaper3y  i.femaleapi i.year i.t sa-sz if e==1, vce(cluster auth)
margins i.femaleapi, at(dstrengthppaper3y==0)
reg strengthppaper3y dstrengthppaper3y  i.femaleapi if e==1, vce(cluster auth)
margins i.femaleapi, at(dstrengthppaper3y==0)

reg clustering3y dclustering3y i.femaleapi i.year i.t sa-sz if e==1, vce(cluster auth)
margins i.femaleapi, at(dclustering3y==0)
reg clustering3y dclustering3y i.femaleapi if e==1, vce(cluster auth)
margins i.femaleapi, at(dclustering3y==0)


set more off
reg degree10y i.femaleapi ddegree10y i.year i.t sa-sz if e==1, vce(cluster auth)  
margins i.femaleapi, at(ddegree10y==0)

reg degree10y i.femaleapi ddegree10y if e==1, vce(cluster auth)  
margins i.femaleapi, at(ddegree10y==0)

reg clustering10y dclustering10y i.femaleapi i.year i.t sa-sz if e==1, vce(cluster auth)
margins i.femaleapi, at(dclustering10y==0)

reg clustering10y dclustering10y i.femaleapi if e==1, vce(cluster auth)
margins i.femaleapi, at(dclustering10y==0)

reg strengthppaper10y dstrengthppaper10y  i.femaleapi i.year i.t sa-sz if e==1, vce(cluster auth)
margins i.femaleapi, at(dstrengthppaper10y==0)

reg strengthppaper10y dstrengthppaper10y  i.femaleapi if e==1, vce(cluster auth)
margins i.femaleapi, at(dstrengthppaper10y==0)

/*Gender, network and output: 3 and 10 year network period*/
set more off	   
/*Lagged networks*/
/*creating lagged network variables and replacing missing values by 0*/
foreach i in degree3y strengthppaper3y clustering3y{
	gen `i'l5=L5.`i'
}
/*adding the lagged missing dummies*/
foreach i in   degree3y strengthppaper3y clustering3y{
	gen d`i'l5=1 if missing(`i'l5) 
	replace d`i'l5=0 if missing(d`i'l5)
    replace `i'l5=0 if missing(`i'l5)
}



set more off

/*Table D.18: Gender, Networks and Output (AIS index). 3-year network period*/
reg lsaisd5y degree3yl5 strengthppaper3yl5 clustering3yl5 ddegree3yl5 dclustering3yl5 dstrengthppaper3yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
gen es2=1 if e(sample)	   

set more off	 
  
reg lsaisd5y i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) replace

reg lsaisd5y i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree3yl5 ddegree3yl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree3yl5 ddegree3yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaper3yl5 dstrengthppaper3yl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaper3yl5 dstrengthppaper3yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clustering3yl5 dclustering3yl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clustering3yl5 dclustering3yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree3yl5 strengthppaper3yl5 clustering3yl5 ddegree3yl5 dclustering3yl5 dstrengthppaper3yl5 i.femaleapi  sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree3yl5 strengthppaper3yl5 clustering3yl5 ddegree3yl5 dclustering3yl5 dstrengthppaper3yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 


/*testing if the differences are statistically significant*/
reg lsaisd5y femaleapi sa-sz i.t i.year if es2==1
estimates store m1
reg lsaisd5y femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m2
reg lsaisd5y degree3yl5 ddegree3yl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m3
reg lsaisd5y degree3yl5 ddegree3yl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m4
reg lsaisd5y strengthppaper3yl5 dstrengthppaper3yl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m5
reg lsaisd5y strengthppaper3yl5 dstrengthppaper3yl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m6
reg lsaisd5y clustering3yl5 dclustering3yl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m7
reg lsaisd5y clustering3yl5 dclustering3yl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m8
reg lsaisd5y ddegree3yl5 dclustering3yl5 dstrengthppaper3yl5 degree3yl5 strengthppaper3yl5 clustering3yl5 femaleapi  sa-sz i.t i.year if es2==1
estimates store m9
reg lsaisd5y ddegree3yl5 dclustering3yl5 dstrengthppaper3yl5 degree3yl5 strengthppaper3yl5 clustering3yl5 femaleapi lcaisdl5  sa-sz i.t i.year if es2==1
estimates store m10

suest m1 m2 m3 m4 m5 m6 m7 m8 m9 m10, noomitted  vce(cluster auth)
test [m1_mean]femaleapi = [m2_mean]femaleapi 
test [m1_mean]femaleapi = [m3_mean]femaleapi 
test [m1_mean]femaleapi = [m4_mean]femaleapi 
test [m1_mean]femaleapi = [m5_mean]femaleapi 
test [m1_mean]femaleapi = [m6_mean]femaleapi 
test [m1_mean]femaleapi = [m7_mean]femaleapi 
test [m1_mean]femaleapi = [m8_mean]femaleapi 
test [m1_mean]femaleapi = [m9_mean]femaleapi 
test [m1_mean]femaleapi = [m10_mean]femaleapi


test [m2_mean]femaleapi = [m3_mean]femaleapi 
test [m2_mean]femaleapi = [m4_mean]femaleapi 
test [m2_mean]femaleapi = [m5_mean]femaleapi 
test [m2_mean]femaleapi = [m6_mean]femaleapi 
test [m2_mean]femaleapi = [m7_mean]femaleapi 
test [m2_mean]femaleapi = [m8_mean]femaleapi 
test [m2_mean]femaleapi = [m9_mean]femaleapi 
test [m2_mean]femaleapi = [m10_mean]femaleapi


/*10 year*/
/*Lagged networks*/
/*creating lagged network variables and replacing missing values by 0*/
foreach i in degree10y strengthppaper10y clustering10y{
	gen `i'l5=L5.`i'
}
/*adding the lagged missing dummies*/
foreach i in   degree10y strengthppaper10y clustering10y{
	gen d`i'l5=1 if missing(`i'l5) 
	replace d`i'l5=0 if missing(d`i'l5)
    replace `i'l5=0 if missing(`i'l5)
}

set more off

drop es2
reg lsaisd5y degree10yl5 strengthppaper10yl5 clustering10yl5 ddegree10yl5 dclustering10yl5 dstrengthppaper10yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
gen es2=1 if e(sample)	   

set more off	 
  
reg lsaisd5y i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) replace

reg lsaisd5y i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree10yl5 ddegree10yl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree10yl5 ddegree10yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaper10yl5 dstrengthppaper10yl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaper10yl5 dstrengthppaper10yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clustering10yl5 dclustering10yl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clustering10yl5 dclustering10yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree10yl5 strengthppaper10yl5 clustering10yl5 ddegree10yl5 dclustering10yl5 dstrengthppaper10yl5 i.femaleapi  sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degree10yl5 strengthppaper10yl5 clustering10yl5 ddegree10yl5 dclustering10yl5 dstrengthppaper10yl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 




/*testing if the differences are statistically significant*/
reg lsaisd5y femaleapi sa-sz i.t i.year if es2==1
estimates store m1
reg lsaisd5y femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m2
reg lsaisd5y degree10yl5 ddegree10yl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m3
reg lsaisd5y degree10yl5 ddegree10yl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m4
reg lsaisd5y strengthppaper10yl5 dstrengthppaper10yl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m5
reg lsaisd5y strengthppaper10yl5 dstrengthppaper10yl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m6
reg lsaisd5y clustering10yl5 dclustering10yl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m7
reg lsaisd5y clustering10yl5 dclustering10yl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m8
reg lsaisd5y ddegree10yl5 dclustering10yl5 dstrengthppaper10yl5 degree10yl5 strengthppaper10yl5 clustering10yl5 femaleapi  sa-sz i.t i.year if es2==1
estimates store m9
reg lsaisd5y ddegree10yl5 dclustering10yl5 dstrengthppaper10yl5 degree10yl5 strengthppaper10yl5 clustering10yl5 femaleapi lcaisdl5  sa-sz i.t i.year if es2==1
estimates store m10

suest m1 m2 m3 m4 m5 m6 m7 m8 m9 m10, noomitted  vce(cluster auth)
test [m1_mean]femaleapi = [m2_mean]femaleapi 
test [m1_mean]femaleapi = [m3_mean]femaleapi 
test [m1_mean]femaleapi = [m4_mean]femaleapi 
test [m1_mean]femaleapi = [m5_mean]femaleapi 
test [m1_mean]femaleapi = [m6_mean]femaleapi 
test [m1_mean]femaleapi = [m7_mean]femaleapi 
test [m1_mean]femaleapi = [m8_mean]femaleapi 
test [m1_mean]femaleapi = [m9_mean]femaleapi 
test [m1_mean]femaleapi = [m10_mean]femaleapi


test [m2_mean]femaleapi = [m3_mean]femaleapi 
test [m2_mean]femaleapi = [m4_mean]femaleapi 
test [m2_mean]femaleapi = [m5_mean]femaleapi 
test [m2_mean]femaleapi = [m6_mean]femaleapi 
test [m2_mean]femaleapi = [m7_mean]femaleapi 
test [m2_mean]femaleapi = [m8_mean]femaleapi 
test [m2_mean]femaleapi = [m9_mean]femaleapi 
test [m2_mean]femaleapi = [m10_mean]femaleapi


	  
	  
* Additional Analysis: Quantile regressions
drop es2
reg lsaisd5y i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
gen es2=1 if e(sample)	 

gen tsq=t^2
/*Table C.12: Degree and Gender: Quantile Regressions*/
set more off
qreg degree femaleapi year t tsq sa-sz if es2==1 & ddegree==0, quantile(.25)
outreg2 using Tableqregdeg, tex dec(3) label addtext(JEL codes FE, YES) replace
qreg degree femaleapi year t tsq sa-sz if es2==1 & ddegree==0, vce(rob) quantile(.50)
outreg2 using Tableqregdeg, tex dec(3) label addtext(JEL codes FE, YES) 
qreg degree femaleapi year t tsq sa-sz if es2==1 & ddegree==0, vce(rob) quantile(.75)
outreg2 using Tableqregdeg, tex dec(3) label addtext(JEL codes FE, YES) 
qreg degree femaleapi year t tsq sa-sz if es2==1 & ddegree==0, vce(rob) quantile(.90)
outreg2 using Tableqregdeg, tex dec(3) label addtext(JEL codes FE, YES) 

/*Table C.13: Clustering and Gender: Quantile Regressions*/
qreg clustering femaleapi year t tsq sa-sz if es2==1 & dclustering==0, vce(rob) quantile(.50)
outreg2 using Tableqregcl, tex dec(3) label addtext(JEL codes FE, YES) replace
qreg clustering femaleapi year t tsq sa-sz if es2==1 & dclustering==0, vce(rob) quantile(.75)
outreg2 using Tableqregcl, tex dec(3) label addtext(JEL codes FE, YES) 
qreg clustering femaleapi year t tsq sa-sz if es2==1 & dclustering==0, vce(rob) quantile(.90)
outreg2 using Tableqregcl, tex dec(3) label addtext(JEL codes FE, YES) 
qreg clustering femaleapi year t tsq sa-sz if es2==1 & dclustering==0, vce(rob) quantile(.25)
outreg2 using Tableqregcl, tex dec(3) label addtext(JEL codes FE, YES) replace

/*Table C.14: Strength and Gender: Quantile Regressions*/
set more off
qreg strengthppaper femaleapi year t tsq if es2==1 & dstrengthppaper==0, vce(rob) quantile(.25)
outreg2 using Tableqregst, tex dec(3) label addtext(JEL codes FE, YES) replace
qreg strengthppaper femaleapi year t tsq sa-sz if es2==1 & dstrengthppaper==0, vce(rob) quantile(.50)
outreg2 using Tableqregst, tex dec(3) label addtext(JEL codes FE, YES) replace
qreg strengthppaper femaleapi year t tsq sa-sz if es2==1 & dstrengthppaper==0, vce(rob) quantile(.75)
outreg2 using Tableqregst, tex dec(3) label addtext(JEL codes FE, YES) 
qreg strengthppaper femaleapi year t tsq sa-sz if es2==1 & dstrengthppaper==0, vce(rob) quantile(.90)
outreg2 using Tableqregst, tex dec(3) label addtext(JEL codes FE, YES) 


* Table C.11: Gender and Collaboration, additional control and measures: 1974-2017

/*Coauthorship (papers adjusted), adjusted mean*/
set more off
reg coauthorship5y dcoauthorship5y i.femaleapi snpapers5y i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dcoauthorship5y==0)

/*Coauthorship (papers adjusted), mean*/
reg coauthorship5y dcoauthorship5y i.femaleapi, vce(cluster auth)
margins femaleapi, at(dcoauthorship5y==0)

/*Degree (papers adjusted), adjusted mean*/
reg degree ddegree i.femaleapi snpapers5y i.year i.t sa-sz, vce(cluster auth)  
margins femaleapi, at(ddegree==0)
/*Degree (papers adjusted), mean*/
reg degree ddegree i.femaleapi, vce(cluster auth)  
margins femaleapi, at(ddegree==0)

/*Strengthppaper (papers adjusted), adjusted mean*/
reg strengthppaper dstrengthppaper i.femaleapi snpapers5y i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dstrengthppaper==0)

/*Strengthppaper (papers adjusted), mean*/
reg strengthppaper dstrengthppaper i.femaleapi, vce(cluster auth)
margins femaleapi, at(dstrengthppaper==0)

/*Clustering (papers adjusted), adjusted mean*/
reg clustering dclustering i.femaleapi snpapers5y  i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dclustering==0) 
/*Clustering (papers adjusted), mean*/
reg clustering dclustering i.femaleapi, vce(cluster auth)
margins femaleapi, at(dclustering==0) 

/*Log(AISc+1) (papers adjusted), adjusted mean*/
reg lavnetprodais dlavnetprodais i.femaleapi snpapers5y  i.year i.t sa-sz, vce(cluster auth)
margins femaleapi 
/*Log(AISc+1) (papers adjusted), mean*/
reg lavnetprodais dlavnetprodais i.femaleapi, vce(cluster auth)
margins femaleapi 
 
/*Average Co-author (papers adjusted) Experience, adjusted mean*/
reg avgcot davgcot i.femaleapi snpapers5y  i.year i.t sa-sz, vce(cluster auth)
margins femaleapi 

/*Average Co-author (papers adjusted) Experience, mean*/
reg avgcot davgcot i.femaleapi, vce(cluster auth)
margins femaleapi

/*Clustering (degree adjusted), adjusted mean*/
reg clustering dclustering degree ddegree i.femaleapi i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dclustering==0 ddegree==0) 
/*Clustering (degree adjusted), mean*/
reg clustering dclustering i.femaleapi, vce(cluster auth)
margins femaleapi, at(dclustering==0) 

/*Coauthor per paper, adjusted mean*/
gen degrepp=degree/snpapers5y	   
reg degrepp ddegree i.femaleapi i.year i.t sa-sz, vce(cluster auth)  
margins femaleapi, at(ddegree==0) 
/*Coauthor per paper, mean*/
reg degrepp ddegree i.femaleapi, vce(cluster auth)  
margins femaleapi, at(ddegree==0)



* Heterogenous effects: high ability authors
*Table D.20: Gender, Networks and Output (AIS index). Heterogeneous effect: high ability authors.*

set more off	 
foreach i in lcaisdl5{
_pctile `i' if `i'!=. & `i'!=0, p(50, 80, 90)
return list 
gen qnt`i' = 4 if (`i'>=r(r3)) & `i'!=. 
replace qnt`i' = 3 if (`i'<r(r3) & `i'>=r(r2)) & `i'!=.
replace qnt`i' = 2 if (`i'<r(r2) & `i'>=r(r1)) & `i'!=.
replace qnt`i'= 1 if (`i'<r(r1))  & `i'!=. 
label variable qnt`i' "Dummy Recent Output Percentiles" 
}
set more off
reg lsaisd5y i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) replace

reg lsaisd5y i.qntlcaisdl5##i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 ddegreel5 i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 ddegreel5 i.qntlcaisdl5##i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 


reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.qntlcaisdl5##i.femaleapi lcaisdl5  sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clusteringl5 dclusteringl5 i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 


reg lsaisd5y clusteringl5 dclusteringl5 i.qntlcaisdl5##i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 i.qntlcaisdl5##i.femaleapi  sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 


reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 i.qntlcaisdl5##i.femaleapi lcaisdl5  sa-sz i.t i.year, vce(cluster auth)
outreg2 using Tablefaisl, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

/*testing if the differences are statistically significant*/

set more off
reg lsaisd5y i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year
estimates store m1
reg lsaisd5y i.qntlcaisdl5##i.femaleapi lcaisdl5 sa-sz i.t i.year
estimates store m2
reg lsaisd5y degreel5 ddegreel5 i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year
estimates store m3
reg lsaisd5y degreel5 ddegreel5 i.qntlcaisdl5##i.femaleapi lcaisdl5 sa-sz i.t i.year
estimates store m4
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year 
estimates store m5
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.qntlcaisdl5##i.femaleapi lcaisdl5  sa-sz i.t i.year
estimates store m6
reg lsaisd5y clusteringl5 dclusteringl5 i.qntlcaisdl5##i.femaleapi sa-sz i.t i.year
estimates store m7
reg lsaisd5y clusteringl5 dclusteringl5 i.qntlcaisdl5##i.femaleapi lcaisdl5 sa-sz i.t i.year
estimates store m8
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 i.qntlcaisdl5##i.femaleapi  sa-sz i.t i.year
estimates store m9
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 i.qntlcaisdl5##i.femaleapi lcaisdl5  sa-sz i.t i.year
estimates store m10


suest m1 m2 m3 m4 m5 m6 m7 m8 m9 m10, noomitted  vce(cluster auth)
test [m1_mean]1.femaleapi = [m2_mean]1.femaleapi 
test [m1_mean]1.femaleapi  = [m3_mean]1.femaleapi 
test [m1_mean]1.femaleapi  = [m4_mean]1.femaleapi  
test [m1_mean]1.femaleapi  = [m5_mean]1.femaleapi  
test [m1_mean]1.femaleapi  = [m6_mean]1.femaleapi 
test [m1_mean]1.femaleapi  = [m7_mean]1.femaleapi  
test [m1_mean]1.femaleapi  = [m8_mean]1.femaleapi 
test [m1_mean]1.femaleapi  = [m9_mean]1.femaleapi 
test [m1_mean]1.femaleapi  = [m10_mean]1.femaleapi 

test [m2_mean]1.femaleapi = [m3_mean]1.femaleapi 
test [m2_mean]1.femaleapi = [m4_mean]1.femaleapi
test [m2_mean]1.femaleapi = [m5_mean]1.femaleapi 
test [m2_mean]1.femaleapi = [m6_mean]1.femaleapi
test [m2_mean]1.femaleapi = [m7_mean]1.femaleapi
test [m2_mean]1.femaleapi = [m8_mean]1.femaleapi
test [m2_mean]1.femaleapi = [m9_mean]1.femaleapi
test [m2_mean]1.femaleapi = [m10_mean]1.femaleapi

/*Checking if the gender gap for highly productive authors in the past (80-99) is significant*/
test [m1_mean]3.qntlcaisdl5#1.femaleapi+[m1_mean]1.femaleapi=0
test [m1_mean]4.qntlcaisdl5#1.femaleapi+[m1_mean]1.femaleapi=0

test [m8_mean]3.qntlcaisdl5#1.femaleapi+[m8_mean]1.femaleapi=0
test [m8_mean]4.qntlcaisdl5#1.femaleapi+[m8_mean]1.femaleapi=0 /*significant at the 10% only*/



* Active sample*

bys auth: egen minpapers=min(snpapers5y)
drop if minpapers<3

foreach i in degree strengthppaper clustering coauthorship5y avgcot lavnetprodais{ 
	drop d`i'
    gen d`i'=1 if missing(`i') & snpapers5y!=.
	replace d`i'=0 if missing(d`i') & snpapers5y!=.
	replace `i'=0 if missing(`i') & snpapers5y!=.
}

*Table C.8: Gender Differences in Networks. Alternative samples*
set more off
xtset auth year, yearly
/*Degree (Research-stream sample), adjusted mean*/
reg degree ddegree i.femaleapi i.year i.t sa-sz, vce(cluster auth)  
margins femaleapi, at(ddegree==0)
/*Degree (Research-stream sample), mean*/
reg degree ddegree i.femaleapi, vce(cluster auth)  
margins femaleapi, at(ddegree==0)
/*Clustering (Research-stream sample), adjusted mean*/
reg clustering dclustering i.femaleapi i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dclustering==0)
/*Clustering (Research-stream sample), mean*/
reg clustering dclustering i.femaleapi, vce(cluster auth)
margins femaleapi, at(dclustering==0)

/*Strength (Research-stream sample),adjusted mean*/
reg strengthppaper dstrengthppaper i.femaleapi i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dstrengthppaper==0)
/*Strength (Research-stream sample), mean*/
reg strengthppaper dstrengthppaper i.femaleapi, vce(cluster auth)
margins femaleapi, at(dstrengthppaper==0)




*Table D.16: Gender, Networks and Output (AIS index). Research-Stream Sample*
drop es2
set more off

reg lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
gen es2=1 if e(sample)	   

set more off	 
  
reg lsaisd5y i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) replace

reg lsaisd5y i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 ddegreel5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 ddegreel5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clusteringl5 dclusteringl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clusteringl5 dclusteringl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi  sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 


/*testing if the differences are statistically significant*/
reg lsaisd5y femaleapi sa-sz i.t i.year if es2==1
estimates store m1
reg lsaisd5y femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m2
reg lsaisd5y degreel5 ddegreel5 femaleapi sa-sz i.t i.year if es2==1
estimates store m3
reg lsaisd5y degreel5 ddegreel5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m4
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m5
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m6
reg lsaisd5y clusteringl5 dclusteringl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m7
reg lsaisd5y clusteringl5 dclusteringl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m8
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 femaleapi  sa-sz i.t i.year if es2==1
estimates store m9
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 femaleapi lcaisdl5  sa-sz i.t i.year if es2==1
estimates store m10

suest m1 m2 m3 m4 m5 m6 m7 m8 m9 m10, noomitted  vce(cluster auth)
test [m1_mean]femaleapi = [m2_mean]femaleapi 
test [m1_mean]femaleapi = [m3_mean]femaleapi 
test [m1_mean]femaleapi = [m4_mean]femaleapi 
test [m1_mean]femaleapi = [m5_mean]femaleapi 
test [m1_mean]femaleapi = [m6_mean]femaleapi 
test [m1_mean]femaleapi = [m7_mean]femaleapi 
test [m1_mean]femaleapi = [m8_mean]femaleapi 
test [m1_mean]femaleapi = [m9_mean]femaleapi 
test [m1_mean]femaleapi = [m10_mean]femaleapi


test [m2_mean]femaleapi = [m3_mean]femaleapi 
test [m2_mean]femaleapi = [m4_mean]femaleapi 
test [m2_mean]femaleapi = [m5_mean]femaleapi 
test [m2_mean]femaleapi = [m6_mean]femaleapi 
test [m2_mean]femaleapi = [m7_mean]femaleapi 
test [m2_mean]femaleapi = [m8_mean]femaleapi 
test [m2_mean]femaleapi = [m9_mean]femaleapi 
test [m2_mean]femaleapi = [m10_mean]femaleapi





/*Figure C.5: Co-authors’ Experience, By Gender*/
use "auth7017fields5y.dta", clear

joinby auth year using neighchar7017_5y, unmatched(master) 
drop _merge avgcot 

/*Creating average coauthors' experience from average coauthors' experience by gender*/

gen ncoauthors=namecom+namecof+namecomis
gen fmale=namecom/ncoauthors
gen ffemaleapi=namecof/ncoauthors
gen nmissing=namecomis/ncoauthors

replace avgtcom=0 if namecom==0
replace avgtcof=0 if namecof==0
replace avgtcomis=0 if namecomis==0

replace fmale=0 if namecom==0
replace ffemaleapi=0 if namecof==0
replace nmissing=0 if namecomis==0

gen avgcot=avgtcom*fmale+avgtcof*ffemaleapi+avgtcomis*nmissing

keep auth t avgtcom avgtcof avgcot femaleapi 

bys t: egen mtcom=mean(avgtcom) if femaleapi==0
bys t: egen mtcof=mean(avgtcof) if femaleapi==0
bys t: egen mtaco=mean(avgcot) if femaleapi==0
bys t: egen mtcomf=mean(avgtcom) if femaleapi==1
bys t: egen mtcoff=mean(avgtcof) if femaleapi==1
bys t: egen mtacof=mean(avgcot) if femaleapi==1
foreach i in mtcom mtcof mtcomf mtcoff mtacof mtaco{
bys t: egen `i'm=max(`i')
drop `i'
}
keep t mtcomm mtcofm mtcomfm mtcoffm mtacofm mtacom
duplicates drop
gen diffcom=mtcomm-mtcomfm
tsset t, yearly
gen diffaco=mtacom-mtacofm

twoway (tsline mtacom if t<30, color(blue) lpattern(dash_dot) lwidth(thick)) ///
       (tsline mtacofm if t<30, lpattern(dash) lwidth(thick)), ///	      
       ytitle("Average coauthors' experience") ///
	   xlabel(1(2)30) ///
       xtitle("Career time")  legend(order(1 "Male" 2 "Female")) scheme(s1color) 
graph export "avgtco_t.pdf", as(pdf) replace



/*FURTHER ROBUSTNESS IN SUPPLEMENTARY APPENDIX: CONTROLLING FOR INSTITUTIONS*/
use "auth7017fields5y.dta", clear
joinby auth year using "authuni_june19.dta", unmatched(master) /* University data up to 2011 comes from paper "The Value of Connection to Power (Lorenzo Ductor and Bauke Visser)"*/
drop if year>2011.  /*affiliation data uncleaned for years 2012-2017*/
drop _merge
drop if ystart<1974

/*Defining the variables*/
label variable cprodl5 "Past Output"
label variable cprod5 "Recent Output"
label variable cproddl5 "Past Output discounted"
label variable cprodd5 "Recent Output discounted"
label variable cprodd "Recent and past Output discounted"
label variable tpapersl5 "Past number of publications"
label variable tpapers5 "Recent number of publications"
label variable tpapersAAl5 "Past number of top 5 publications"
label variable tpapersAA5 "Recent number of top 5  publications"
label variable caisdl5 "Past Output discounted"
label variable caisd5 "Recent Output discounted"
label variable clustering "Clustering"
label variable femaleapi "femaleapi"



set more off
drop if year<1990 /*removing observations before 1990 as affiliations are missing*/
reghdfe sprodd5 femaleapi i.t i.year sa-sz, cluster(auth) absorb(uniid)
gen e=1 if e(sample)
gen x=1
/*Table B.2: Gender differences in Economics. Accounting for Institutions*/

/*# Publications, mean*/
reghdfe snpapers5y i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, atmeans
/*# Publications, Adjusted Mean (Inst.)*/
reghdfe snpapers5y i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans
/*# Publications, Adjusted Mean (All)*/
reghdfe snpapers5y i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans
/* # Top 5 Publications, mean*/
reghdfe snpapersAA5 i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, atmeans
/* # Top 5 Publications, Adjusted Mean (Inst.)*/
reghdfe snpapersAA5 i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans
/*# Top 5 Publications, Adjusted Mean (All)*/
reghdfe snpapersAA5 i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans
/*AIS, mean*/
reghdfe saisd5y i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, atmeans
/*AIS, Adjusted Mean (Inst.)*/
reghdfe saisd5y i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans
/*AIS, Adjusted Mean (All)*/
reghdfe saisd5y i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans



/*Networks*/

xtset auth year, yearly
/*Degree, mean*/
reghdfe degree ddegree i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, at(ddegree==0)
/*Degree, Adjusted Mean (Inst.)*/
reghdfe degree ddegree i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(ddegree==0)
/*Degree, Adjusted Mean (All)*/
reghdfe degree ddegree i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(ddegree==0)
/*Strength, mean*/
reghdfe strengthppaper dstrengthppaper i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, at(dstrengthppaper==0)
/*Strength, Adjusted Mean (Inst.)*/
reghdfe strengthppaper dstrengthppaper i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(dstrengthppaper==0)
/*Strength, Adjusted Mean (All)*/
reghdfe strengthppaper dstrengthppaper i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(dstrengthppaper==0)
/*Clustering, mean*/
reghdfe clustering dclustering i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, at(dclustering==0)
/*Clustering, Adjusted Mean (Inst.)*/
reghdfe clustering dclustering i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(dclustering==0)
/*Clustering, Adjusted Mean (All)*/
reghdfe clustering dclustering i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(dclustering==0)

/*Co-authorship, mean*/
reghdfe coauthorship5y dcoauthorship5y i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, at(dcoauthorship5y==0)
/*Co-authorship, Adjusted Mean (Inst.)*/
reghdfe coauthorship5y dcoauthorship5y i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(dcoauthorship5y==0)
/*Co-authorship, Adjusted Mean (All)*/
reghdfe coauthorship5y dcoauthorship5y i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, at(dcoauthorship5y==0)


/* Average Co-author Experience, Mean*/
reghdfe avgcot davgcot i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, atmeans
/*Average Co-author Experience, Adjusted Mean (Inst.)*/
reghdfe avgcot davgcot i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans
/*Average Co-author Experience, Adjusted Mean (All)*/
reghdfe avgcot davgcot i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans

/*Log(AISc +1), Mean*/
reghdfe lavnetprodais dlavnetprodais i.femaleapi if e==1, cluster(auth) absorb(x)
margins i.femaleapi, atmeans
/*Log(AISc +1), Adjusted Mean (Inst.)*/
reghdfe lavnetprodais dlavnetprodais i.femaleapi if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans
/*Log(AISc +1), Adjusted Mean (All)*/
reghdfe lavnetprodais dlavnetprodais i.femaleapi i.t i.year sa-sz if e==1, cluster(auth) absorb(uniid)
margins i.femaleapi, atmeans


/*Table D.15: Gender, Networks and Output (AIS index). Accounting for Institutions*/

set more off
reghdfe lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year, vce(cluster auth)
gen es2=1 if e(sample)	   

set more off	 
  
reghdfe lsaisd5y i.femaleapi sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) replace

reghdfe lsaisd5y i.femaleapi lcaisdl5 sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y degreel5 ddegreel5 i.femaleapi sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y degreel5 ddegreel5 i.femaleapi lcaisdl5 sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y strengthppaperl5 dstrengthppaperl5 i.femaleapi sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y strengthppaperl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y clusteringl5 dclusteringl5 i.femaleapi sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y clusteringl5 dclusteringl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi  sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reghdfe lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if e==1, vce(cluster auth) absorb(uniid)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 


/*testing if the differences are statistically significant*/
reg lsaisd5y femaleapi sa-sz i.t i.year i.uniid if e==1
estimates store m1
reg lsaisd5y femaleapi lcaisdl5 sa-sz i.t i.year i.uniid if e==1
estimates store m2
reg lsaisd5y degreel5 ddegreel5 femaleapi sa-sz i.t i.year i.uniid if e==1
estimates store m3
reg lsaisd5y degreel5 ddegreel5 femaleapi lcaisdl5 sa-sz i.t i.year i.uniid if e==1
estimates store m4
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 femaleapi sa-sz i.t i.year i.uniid if e==1
estimates store m5
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 femaleapi lcaisdl5 sa-sz i.t i.year i.uniid if e==1
estimates store m6
reg lsaisd5y clusteringl5 dclusteringl5 femaleapi sa-sz i.t i.year i.uniid if e==1
estimates store m7
reg lsaisd5y clusteringl5 dclusteringl5 femaleapi lcaisdl5 sa-sz i.t i.year i.uniid if e==1
estimates store m8
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 femaleapi  sa-sz i.t i.year i.uniid if e==1
estimates store m9
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 femaleapi lcaisdl5  sa-sz i.t i.year i.uniid if e==1
estimates store m10

suest m1 m2 m3 m4 m5 m6 m7 m8 m9 m10, noomitted  vce(cluster auth)
test [m1_mean]femaleapi = [m2_mean]femaleapi 
test [m1_mean]femaleapi = [m3_mean]femaleapi 
test [m1_mean]femaleapi = [m4_mean]femaleapi 
test [m1_mean]femaleapi = [m5_mean]femaleapi 
test [m1_mean]femaleapi = [m6_mean]femaleapi 
test [m1_mean]femaleapi = [m7_mean]femaleapi 
test [m1_mean]femaleapi = [m8_mean]femaleapi 
test [m1_mean]femaleapi = [m9_mean]femaleapi 
test [m1_mean]femaleapi = [m10_mean]femaleapi


test [m2_mean]femaleapi = [m3_mean]femaleapi 
test [m2_mean]femaleapi = [m4_mean]femaleapi 
test [m2_mean]femaleapi = [m5_mean]femaleapi 
test [m2_mean]femaleapi = [m6_mean]femaleapi 
test [m2_mean]femaleapi = [m7_mean]femaleapi 
test [m2_mean]femaleapi = [m8_mean]femaleapi 
test [m2_mean]femaleapi = [m9_mean]femaleapi 
test [m2_mean]femaleapi = [m10_mean]femaleapi


/*FURTHER ROBUSTNESS IN SUPPLEMENTARY APPENDIX: RESTRITED SET OF JOURNAL. NEED TO CREATE A NEW DATABASE
/1) *********************RESTRICTED SET OF JOURNALS*****************************/

/*Creating data 1: Networks; run after R code*/
set more off
import delimited "networkgender7017.csv", clear
drop if nauthors<0
merge m:1 journalid using journal
drop _merge
#delimit ;
keep if journalname=="Accounting-Review"|
journalname=="American-Economic-Review"|
journalname=="American-Journal-of-Agricultural-Economics"|
journalname=="American-Journal-of-Economics-and-Sociology"|
journalname=="Antitrust-Bulletin"|
journalname=="Aussenwirtschaft"|
journalname=="Australian-Economic-Papers"|
journalname=="Australian-Economic-Review"|
journalname=="Brookings-Papers-on-Economic-Activity"|
journalname=="Bulletin-of-Economic-Research"|
journalname=="Business-History-Review"|
journalname=="Canadian-Journal-of-Agricultural-Economics"|
journalname=="Canadian-Journal-of-Economics"|
journalname=="De-Economist"|
journalname=="Eastern-European-Economics"|
journalname=="Econometrica"|
journalname=="Economic-Development-and-Cultural-Change"|
journalname=="Economic-Geography"|
journalname=="Economic-Journal"|
journalname=="Economic-Record"|
journalname=="Ekonomiska-Samfundets-Tidskrift"|
journalname=="Explorations-in-Economic-History"|
journalname=="Federal-Reserve-Bank-of-St.-Louis-Review"|
journalname=="Federal-Reserve-Bulletin"|
journalname=="Foreign-Affairs"|
journalname=="Growth-and-Change"|
journalname=="History-of-Political-Economy"|
journalname=="Hitotsubashi-Journal-of-Economics"|
journalname=="Indian-Economic-Journal"|
journalname=="Industrial-Relations"|
journalname=="Industrial-and-Labor-Relations-Review"|
journalname=="International-Economic-Review"|
journalname=="International-Labour-Review"|
journalname=="Jahrbucher-fur-Nationalokonomie-und-Statistik"|
journalname=="Journal-of-Common-Market-Studies"|
journalname=="Journal-of-Development-Studies"|
journalname=="Journal-of-Economic-History"|
journalname=="Journal-of-Economic-Issues"|
journalname=="Journal-of-Economic-Literature"|
journalname=="Journal-of-Economic-Theory"|
journalname=="Journal-of-Finance"|
journalname=="Journal-of-Financial-and-Quantitative-Analysis"|
journalname=="Journal-of-Human-Resources"|
journalname=="Journal-of-Industrial-Economics"|
journalname=="Journal-of-Law-and-Economics"|
journalname=="Journal-of-Money,-Credit,-and-Banking"|
journalname=="Journal-of-Political-Economy"|
journalname=="Journal-of-Regional-Science"|
journalname=="Journal-of-Risk-and-Insurance"|
journalname=="Journal-of-Transport-Economics-and-Policy"|
journalname=="Journal-of-the-American-Statistical-Association"|
journalname=="Labor-History"|
journalname=="Michigan-Law-Review"|
journalname=="Monthly-Labor-Review"|
journalname=="National-Tax-Journal"|
journalname=="Natural-Resources-Journal"|
journalname=="Public-Choice"|
journalname=="Quarterly-Journal-of-Economics"|
journalname=="Review-of-Economics-and-Statistics"|
journalname=="Review-of-Income-and-Wealth"|
journalname=="Review-of-Radical-Political-Economics"|
journalname=="Review-of-Social-Economy"|
journalname=="Revue-Economique"|
journalname=="Science-and-Society"|
journalname=="Scottish-Journal-of-Political-Economy"|
journalname=="Social-Science-Quarterly"|
journalname=="South-African-Journal-of-Economics"|
journalname=="Southern-Economic-Journal"|
journalname=="Survey-of-Current-Business"|
journalname=="Yale-Law-Journal";
#delimit cr
export delimited using "networkgenders70.csv", replace /*file exported for the network analysis*/


*Run the code below after running R
set more off
forval i = 1974/2011{
insheet using "network`i'_5y.csv",clear
gen year=`i'
drop v1
rename vgauth auth
sort auth year
order auth year
rename vgdeg degree
rename vgdeg2 degree2
rename vgnetprod netprod
rename vgnetprod2 netprod2
rename vgtran clustering
save network`i'_5ys70,replace
}
use network1974_5ys70, clear
forval i = 1975/2011{
append using network`i'_5ys70
}
drop if degree==0
save network_5ys70, replace

/*Creating data 2: strength*/
set more off 
forvalues i=1974/2017{
use Allarticles7017ver2.dta, clear
drop if nauthors<0
merge m:1 journalid using journal
drop if _merge==2
drop _merge
#delimit ;
keep if journalname=="Accounting-Review"|
journalname=="American-Economic-Review"|
journalname=="American-Journal-of-Agricultural-Economics"|
journalname=="American-Journal-of-Economics-and-Sociology"|
journalname=="Antitrust-Bulletin"|
journalname=="Aussenwirtschaft"|
journalname=="Australian-Economic-Papers"|
journalname=="Australian-Economic-Review"|
journalname=="Brookings-Papers-on-Economic-Activity"|
journalname=="Bulletin-of-Economic-Research"|
journalname=="Business-History-Review"|
journalname=="Canadian-Journal-of-Agricultural-Economics"|
journalname=="Canadian-Journal-of-Economics"|
journalname=="De-Economist"|
journalname=="Eastern-European-Economics"|
journalname=="Econometrica"|
journalname=="Economic-Development-and-Cultural-Change"|
journalname=="Economic-Geography"|
journalname=="Economic-Journal"|
journalname=="Economic-Record"|
journalname=="Ekonomiska-Samfundets-Tidskrift"|
journalname=="Explorations-in-Economic-History"|
journalname=="Federal-Reserve-Bank-of-St.-Louis-Review"|
journalname=="Federal-Reserve-Bulletin"|
journalname=="Foreign-Affairs"|
journalname=="Growth-and-Change"|
journalname=="History-of-Political-Economy"|
journalname=="Hitotsubashi-Journal-of-Economics"|
journalname=="Indian-Economic-Journal"|
journalname=="Industrial-Relations"|
journalname=="Industrial-and-Labor-Relations-Review"|
journalname=="International-Economic-Review"|
journalname=="International-Labour-Review"|
journalname=="Jahrbucher-fur-Nationalokonomie-und-Statistik"|
journalname=="Journal-of-Common-Market-Studies"|
journalname=="Journal-of-Development-Studies"|
journalname=="Journal-of-Economic-History"|
journalname=="Journal-of-Economic-Issues"|
journalname=="Journal-of-Economic-Literature"|
journalname=="Journal-of-Economic-Theory"|
journalname=="Journal-of-Finance"|
journalname=="Journal-of-Financial-and-Quantitative-Analysis"|
journalname=="Journal-of-Human-Resources"|
journalname=="Journal-of-Industrial-Economics"|
journalname=="Journal-of-Law-and-Economics"|
journalname=="Journal-of-Money,-Credit,-and-Banking"|
journalname=="Journal-of-Political-Economy"|
journalname=="Journal-of-Regional-Science"|
journalname=="Journal-of-Risk-and-Insurance"|
journalname=="Journal-of-Transport-Economics-and-Policy"|
journalname=="Journal-of-the-American-Statistical-Association"|
journalname=="Labor-History"|
journalname=="Michigan-Law-Review"|
journalname=="Monthly-Labor-Review"|
journalname=="National-Tax-Journal"|
journalname=="Natural-Resources-Journal"|
journalname=="Public-Choice"|
journalname=="Quarterly-Journal-of-Economics"|
journalname=="Review-of-Economics-and-Statistics"|
journalname=="Review-of-Income-and-Wealth"|
journalname=="Review-of-Radical-Political-Economics"|
journalname=="Review-of-Social-Economy"|
journalname=="Revue-Economique"|
journalname=="Science-and-Society"|
journalname=="Scottish-Journal-of-Political-Economy"|
journalname=="Social-Science-Quarterly"|
journalname=="South-African-Journal-of-Economics"|
journalname=="Southern-Economic-Journal"|
journalname=="Survey-of-Current-Business"|
journalname=="Yale-Law-Journal";
#delimit cr
gen year2=.
drop if year<`i'-4
keep if year<`i'+1
drop if auth2==. & nauthors>=2
drop if auth3==. & nauthors>=3
drop if auth4==. & nauthors>=4
drop if auth5==. & nauthors>=5
drop if auth6==. & nauthors>=6
drop if auth7==. & nauthors>=7
keep articleid year auth1 auth2 auth3 auth4 auth5 auth6 auth7 nauthors year2 
bys articleid: gen t=_n
reshape long auth, i(articleid t) j(n)
drop if auth==.
bys articleid auth: gen np=_n /*checking articles with duplicated auth id*/
bys articleid auth: gen sn=_N
keep if np==1 /* 10 articles with duplicated authid, keeping one*/
gen x=1
drop n sn
bys auth: egen snpapers5=sum(x)
drop if nauthors<2
expand nauthors
sort articleid auth
by articleid auth: gen numid2 = _n
by articleid: gen auth2 = auth[nauthors * numid2]
drop if auth==auth2
bys auth: gen d=_n
bys auth: egen degree=max(d)
egen newid = group(auth auth2)
bys newid: gen intensity = _N
bys newid: gen intensityd =intensity/(nauthors-1)
drop if newid==.
keep auth auth2 newid intensity intensityd snpapers5 year2 degree 
duplicates drop
bys auth: egen strength=mean(intensity)
bys auth: egen strengths=sum(intensity)
bys auth: egen strengthd=mean(intensityd)
bys auth: egen strengthsd=sum(intensityd)
bys auth: gen strengthppaper=strength/snpapers5
bys auth: gen strengthppaperd=strengthd/snpapers5
keep auth strength strengthppaper strengths strengthd strengthppaperd strengthsd year2 
duplicates drop
replace year2=`i'
save strength`i's70,  replace 
}

use strength1974s70, clear
forvalues i=1975/2017{
append using strength`i's70
}
rename year2 year
rename auth auth
save strength7017s70, replace

/*Creating data 3: Productivity over time, fixing a set of journals*/
set more off
import delimited "networkgender7017.csv", clear
drop if nauthors<0
merge m:1 journalid using journal
drop _merge
#delimit ;
keep if journalname=="Accounting-Review"|
journalname=="American-Economic-Review"|
journalname=="American-Journal-of-Agricultural-Economics"|
journalname=="American-Journal-of-Economics-and-Sociology"|
journalname=="Antitrust-Bulletin"|
journalname=="Aussenwirtschaft"|
journalname=="Australian-Economic-Papers"|
journalname=="Australian-Economic-Review"|
journalname=="Brookings-Papers-on-Economic-Activity"|
journalname=="Bulletin-of-Economic-Research"|
journalname=="Business-History-Review"|
journalname=="Canadian-Journal-of-Agricultural-Economics"|
journalname=="Canadian-Journal-of-Economics"|
journalname=="De-Economist"|
journalname=="Eastern-European-Economics"|
journalname=="Econometrica"|
journalname=="Economic-Development-and-Cultural-Change"|
journalname=="Economic-Geography"|
journalname=="Economic-Journal"|
journalname=="Economic-Record"|
journalname=="Ekonomiska-Samfundets-Tidskrift"|
journalname=="Explorations-in-Economic-History"|
journalname=="Federal-Reserve-Bank-of-St.-Louis-Review"|
journalname=="Federal-Reserve-Bulletin"|
journalname=="Foreign-Affairs"|
journalname=="Growth-and-Change"|
journalname=="History-of-Political-Economy"|
journalname=="Hitotsubashi-Journal-of-Economics"|
journalname=="Indian-Economic-Journal"|
journalname=="Industrial-Relations"|
journalname=="Industrial-and-Labor-Relations-Review"|
journalname=="International-Economic-Review"|
journalname=="International-Labour-Review"|
journalname=="Jahrbucher-fur-Nationalokonomie-und-Statistik"|
journalname=="Journal-of-Common-Market-Studies"|
journalname=="Journal-of-Development-Studies"|
journalname=="Journal-of-Economic-History"|
journalname=="Journal-of-Economic-Issues"|
journalname=="Journal-of-Economic-Literature"|
journalname=="Journal-of-Economic-Theory"|
journalname=="Journal-of-Finance"|
journalname=="Journal-of-Financial-and-Quantitative-Analysis"|
journalname=="Journal-of-Human-Resources"|
journalname=="Journal-of-Industrial-Economics"|
journalname=="Journal-of-Law-and-Economics"|
journalname=="Journal-of-Money,-Credit,-and-Banking"|
journalname=="Journal-of-Political-Economy"|
journalname=="Journal-of-Regional-Science"|
journalname=="Journal-of-Risk-and-Insurance"|
journalname=="Journal-of-Transport-Economics-and-Policy"|
journalname=="Journal-of-the-American-Statistical-Association"|
journalname=="Labor-History"|
journalname=="Michigan-Law-Review"|
journalname=="Monthly-Labor-Review"|
journalname=="National-Tax-Journal"|
journalname=="Natural-Resources-Journal"|
journalname=="Public-Choice"|
journalname=="Quarterly-Journal-of-Economics"|
journalname=="Review-of-Economics-and-Statistics"|
journalname=="Review-of-Income-and-Wealth"|
journalname=="Review-of-Radical-Political-Economics"|
journalname=="Review-of-Social-Economy"|
journalname=="Revue-Economique"|
journalname=="Science-and-Society"|
journalname=="Scottish-Journal-of-Political-Economy"|
journalname=="Social-Science-Quarterly"|
journalname=="South-African-Journal-of-Economics"|
journalname=="Southern-Economic-Journal"|
journalname=="Survey-of-Current-Business"|
journalname=="Yale-Law-Journal";
#delimit cr


bys articleid: gen ts=_n
drop n
reshape long auth femaleapi, i(articleid ts) j(n)
drop if auth==.


drop articleid t n journalid journalname

sort auth year 

drop if auth==.
gen co=1 if nauthors>1
replace co=0 if nauthors<=1
bys auth year: egen ncopapers=sum(co)
bys auth year: egen sprodd=sum(prodd)
bys auth year: egen sprod=sum(prod)
bys auth year: egen mnauthors=mean(nauthors)
bys auth year: gen snpapers=_N





foreach i of varlist a-z{
bys auth year: egen s`i'=sum(`i')
drop `i'
}

keep auth femaleapi year sa-sz sprodd sprod mnauthors snpapers ncopapers
duplicates drop
xtset auth year, yearly
bys auth: egen ystart=min(year)
bys auth: egen yend=max(year)
save auth7017s70, replace


/* generate a list of all author idcodes in the data */
collapse (mean) year, by(auth)
keep auth
save authorlists70, replace

/* create a file with each author by year, and identify the beginning
   and end of publishing career */
set more off
clear 
set obs 43
gen year=_n+1968
tab year

cross using authorlists70

sort auth year
merge auth year using auth7017s70, sort
tab _merge
drop _merge
compress

*sum

egen mystart=mean(ystart), by(auth)
drop if year<mystart

egen myend=mean(yend), by(auth)

drop ystart yend
rename mystart ystart
rename myend yend
drop if year>yend
save auth7017s70, replace

/*Adding gender, fields and strength*/
set more off
use auth7017s70.dta, clear

joinby auth year using "network_5ys70.dta", unmatched(master)
drop _merge


label variable degree "Degree"
label variable degree2 "Degree of order 2"

bys auth: egen genderm=max(femaleapi)
drop femaleapi
rename genderm female
sort auth year
order auth year female

joinby auth year using strength7017s70, unmatched(master)
drop _merge

/*Defining the panel as the author's last publication*/

gen t=(year-ystar)+1


foreach i in sprodd sprod mnauthors snpapers {
replace `i'=0 if missing(`i')
} 

foreach i of varlist sa-sz{
replace `i'=0 if missing(`i')
} 

xtset auth year, yearly

gen prod5d=(sprodd+L.sprodd+L2.sprodd+L3.sprodd+L4.sprodd)/5
gen prod5=(sprod+L.sprod+L2.sprod+L3.sprod+L4.sprod)/5
gen sprod5d=(sprodd+L.sprodd+L2.sprodd+L3.sprodd+L4.sprodd)
gen sprod5=(sprod+L.sprod+L2.sprod+L3.sprod+L4.sprod)
gen snpapers5y=(snpapers+L.snpapers+L2.snpapers+L3.snpapers+L4.snpapers)



xtset auth year, yearly
foreach i in snpapers ncopapers{
gen `i'l=L.`i'
gen `i'l2=L2.`i'
gen `i'l3=L3.`i'
gen `i'l4=L4.`i'
}
egen sncopapers5=rowtotal(ncopapers ncopapersl ncopapersl2 ncopapersl3 ncopapersl4)
egen snpapers5b=rowtotal(snpapers snpapersl snpapersl2 snpapersl3 snpapersl4)
gen coauthorship5y=sncopapers5/snpapers5b

bys auth: gen cprodd=sum(sprodd)
bys auth: gen cprod=sum(sprod)
bys auth: gen totpapers=sum(snpapers)
replace degree=0 if missing(degree) & snpapers5y!=0
gen cprodl5=L5.cprod
gen cprod5=cprod-cprodl5
gen cproddl5=L5.cprodd
gen cprodd5=cprodd-cproddl5
gen tpapersl5=L5.totpapers
gen tpapers5=totpapers-tpapersl5
bys auth: egen mt=max(t)
set more off
label variable clustering "Clustering"
label variable female "Female"
label variable cprodl5 "Past Output"
label variable cprod5 "Recent Output"
label variable cproddl5 "Past Output discounted"
label variable cprodd5 "Recent Output discounted"
label variable cprodd "Recent and past Output discounted"
label variable tpapersl5 "Past number of publications"
label variable tpapers5 "Recent number of publications"
save auth7017s70, replace


use auth7017s70, clear
drop if ystart<1974

gen pub=1 if snpapers!=0
replace pub=0 if snpapers==0
bys auth: gen cnpapers=sum(snpapers)


joinby auth year using "aisauthyear.dta", unmatched(master)
drop _merge

joinby auth year using top5, unmatched(master)
drop _merge

foreach i in sais saisd snpapersAA{
replace `i'=0 if missing(`i')
gen `i'5y=(`i'+L.`i'+L2.`i'+L3.`i'+L4.`i')
} 

/*Creating cumulative output*/
bys auth: gen caisd=sum(saisd)
bys auth: gen cais=sum(sais)
bys auth: gen tpapersAA=sum(snpapersAA)

/*Creating past output based on AIS*/
gen caisdl5=L5.caisd
/*Creating recent output based on AIS*/
gen caisd5=caisd-caisdl5

/*Creating past output based on top 5 publications*/
gen tpapersAAl5=L5.tpapersAA
/*Creating recent output based on top 5*/
gen tpapersAA5=tpapersAA-tpapersAAl5

foreach i of varlist sa-sz{
set more off
gen `i'l=L.`i'
gen `i'l2=L2.`i'
gen `i'l3=L3.`i'
gen `i'l4=L4.`i'
egen `i'5y=rowtotal(`i' `i'l `i'l2 `i'l3 `i'l4)
drop `i' `i'l `i'l2 `i'l3 `i'l4 
rename `i'5y `i'
}
drop snpapersl snpapersl2 snpapersl3 snpapersl4 snpapers5b

foreach i in snpapers{
gen `i'l=L.`i'
gen `i'l2=L2.`i'
gen `i'l3=L3.`i'
gen `i'l4=L4.`i'
egen `i'5yb=rowtotal(`i' `i'l `i'l2 `i'l3 `i'l4)
drop `i' `i'l `i'l2 `i'l3 `i'l4 
}

duplicates drop  
foreach i of varlist sa-sz{
replace `i'=`i'/snpapers5yb
} 

foreach i of varlist sa-sz{
bys auth: egen m`i'=mean(`i')
}
foreach i of varlist sa-sz{
replace `i'=0 if missing(`i')
} 

foreach i in degree strengthppaper clustering{ 
    gen d`i'=1 if missing(`i') & snpapers5y!=.
	replace d`i'=0 if missing(d`i') & snpapers5y!=.
	replace `i'=0 if missing(`i') & snpapers5y!=.
}

foreach i in degree strengthppaper clustering{
	gen `i'l5=L5.`i'
}
/*adding the lagged missing dummies*/
foreach i in   degree strengthppaper clustering{
	gen d`i'l5=1 if missing(`i'l5) 
	replace d`i'l5=0 if missing(d`i'l5)
    replace `i'l5=0 if missing(`i'l5)
}
  
set more off
gen lsaisd5y=log(saisd5y+1)
gen lcaisdl5=log(caisdl5+1)
replace lcaisdl5=0 if missing(lcaisdl5)
replace lsaisd5y=0 if missing(lsaisd5y)




/*Gender and output*/
/*Table B.3: Gender Differences in Performance. Alternative 2017*/
/*AIS (Restricted journals)*/
reg saisd5y i.female i.t i.year sa-sz, cluster(auth) 
margins i.female, atmeans
ttest saisd5y, by(female) unequal
/*# Publications (Restricted journals)*/
reg snpapers5y i.female i.t i.year sa-sz, cluster(auth) 
margins i.female, atmeans
ttest snpapers5y, by(female) unequal
/*# Top 5 Publications (Restricted journals)*/
reg snpapersAA5y i.female i.t i.year sa-sz, cluster(auth) 
margins i.female, atmeans
ttest snpapersAA5y, by(female) unequal



/*Gender and networks*/
/*Table C.8: Gender Differences in Networks. Alternative samples*/
set more off


/*Degree, Adjusted (Restricted journals)*/
rename female femaleapi
reg degree ddegree i.femaleapi i.year i.t sa-sz, vce(cluster auth)  
margins femaleapi, at(ddegree==0)
/*Degree, Unadjusted (Restricted journals)*/
reg degree ddegree i.femaleapi, vce(cluster auth)  
margins femaleapi, at(ddegree==0)

/*Clustering, Adjusted (Restricted journals)*/
reg clustering dclustering i.femaleapi i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dclustering==0)

/*Clustering, Unadjusted (Restricted journals)*/
reg clustering dclustering i.femaleapi, vce(cluster auth)
margins femaleapi, at(dclustering==0)

/*Strength Adjusted (Restricted journals)*/
reg strengthppaper dstrengthppaper i.femaleapi i.year i.t sa-sz, vce(cluster auth)
margins femaleapi, at(dstrengthppaper==0)
/*Strength Unadjusted (Restricted journals)*/
reg strengthppaper dstrengthppaper i.femaleapi, vce(cluster auth)
margins femaleapi, at(dstrengthppaper==0)


/*Gender, output and networks*/

set more off	 

reg lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi sa-sz i.t i.year, vce(cluster auth)
gen es2=1 if e(sample)	   

set more off	 
  
reg lsaisd5y i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) replace

reg lsaisd5y i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 ddegreel5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year ddegreel5 ) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 ddegreel5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year ddegreel5 ) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year dstrengthppaperl5) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y strengthppaperl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year dstrengthppaperl5) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clusteringl5 dclusteringl5 i.femaleapi sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year dclusteringl5) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y clusteringl5 dclusteringl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year dclusteringl5) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi  sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year ddegreel5 dclusteringl5 dstrengthppaperl5) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 

reg lsaisd5y degreel5 strengthppaperl5 clusteringl5 ddegreel5 dclusteringl5 dstrengthppaperl5 i.femaleapi lcaisdl5 sa-sz i.t i.year if es2==1, vce(cluster auth)
outreg2 using Tablefpapersais, tex dec(3) drop(sa-sz i.t i.year ddegreel5 dclusteringl5 dstrengthppaperl5) label addtext(Career-time FE, YES, Year FE, YES, JEL codes shares, YES) 


/*testing if the differences are statistically significant*/
reg lsaisd5y femaleapi sa-sz i.t i.year if es2==1
estimates store m1
reg lsaisd5y femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m2
reg lsaisd5y degreel5 ddegreel5 femaleapi sa-sz i.t i.year if es2==1
estimates store m3
reg lsaisd5y degreel5 ddegreel5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m4
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m5
reg lsaisd5y strengthppaperl5 dstrengthppaperl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m6
reg lsaisd5y clusteringl5 dclusteringl5 femaleapi sa-sz i.t i.year if es2==1
estimates store m7
reg lsaisd5y clusteringl5 dclusteringl5 femaleapi lcaisdl5 sa-sz i.t i.year if es2==1
estimates store m8
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 femaleapi  sa-sz i.t i.year if es2==1
estimates store m9
reg lsaisd5y ddegreel5 dclusteringl5 dstrengthppaperl5 degreel5 strengthppaperl5 clusteringl5 femaleapi lcaisdl5  sa-sz i.t i.year if es2==1
estimates store m10

suest m1 m2 m3 m4 m5 m6 m7 m8 m9 m10, noomitted  vce(cluster auth)
test [m1_mean]femaleapi = [m2_mean]femaleapi 
test [m1_mean]femaleapi = [m3_mean]femaleapi 
test [m1_mean]femaleapi = [m4_mean]femaleapi 
test [m1_mean]femaleapi = [m5_mean]femaleapi 
test [m1_mean]femaleapi = [m6_mean]femaleapi 
test [m1_mean]femaleapi = [m7_mean]femaleapi 
test [m1_mean]femaleapi = [m8_mean]femaleapi 
test [m1_mean]femaleapi = [m9_mean]femaleapi 
test [m1_mean]femaleapi = [m10_mean]femaleapi


test [m2_mean]femaleapi = [m3_mean]femaleapi 
test [m2_mean]femaleapi = [m4_mean]femaleapi 
test [m2_mean]femaleapi = [m5_mean]femaleapi 
test [m2_mean]femaleapi = [m6_mean]femaleapi 
test [m2_mean]femaleapi = [m7_mean]femaleapi 
test [m2_mean]femaleapi = [m8_mean]femaleapi 
test [m2_mean]femaleapi = [m9_mean]femaleapi 
test [m2_mean]femaleapi = [m10_mean]femaleapi 

  
  






